package test.boid;

import java.awt.Graphics;

import dviz.visualAnnotation.ConstructMap;
import dviz.visualAnnotation.FunctionMap;
import dviz.visualAnnotation.NodeProperty;
import dviz.visualAnnotation.AttachVO;
import dviz.visualAnnotation.Param;
import dviz.visualAnnotation.PropertyMap;
import dviz.visualAspect.MetaPropertyMap.Type;

/**
 * @author zxq071000
 */
@AttachVO("NodeObject")
public class Creatures {

	/**
	 * @uml.property name="boids"
	 * @uml.associationEnd
	 */
	BoidList boids;
	/**
	 * @uml.property name="predators"
	 * @uml.associationEnd
	 */
	PredatorList predators;

	

	@FunctionMap("addNode")
	public void setBoids(@Param("b") BoidList boids) {
		this.boids = boids;
	}

	@FunctionMap("addNode")
	public void setPredators(@Param("p") PredatorList predators) {
		this.predators = predators;
	}

	@ConstructMap
	public Creatures() {
		setBoids(new BoidList());
		setPredators(new PredatorList());
	}

	void draw(Graphics g) {
		boids.draw(g, predators);
		predators.draw(g, boids);
	}

	/**
	 * @param boid
	 */
	public void addBoid(@Param("Boid") Boid boid) {
		boids.add(boid);

	}

	/**
	 * @param predator2
	 */
	public void addPredator(@Param("Boid") Predator predator) {
		predators.add(predator);

	}

	/**
	 * @return
	 */
	public int boidsSize() {
		return boids.size();
	}

	/**
	 * @return
	 */
	public int predatorsSize() {
		return predators.size();
	}

	/**
	 * @param i
	 */
	// @FunctionMap("removeNode")
	public void removeBoid(int i) {
		boids.remove(i);
	}

	// @FunctionMap("removeNode")
	public void removePredator(int i) {
		predators.remove(i);
	}

	/**
	 * @param boids
	 */
	public void setMain(Boids main) {
		boids.setMain(main);

	}

}
